﻿# CMakeList.txt: LuaGui 的 CMake 项目，在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.8)

project ("main")

IF(MSVC)
    foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
        if(${flag_var} MATCHES "/MD")
            string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
       endif(${flag_var} MATCHES "/MD")
        if(${flag_var} MATCHES "/MDd")
            string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
        endif(${flag_var} MATCHES "/MDd")
    endforeach(flag_var)
ENDIF()

if (SERVER)
    add_subdirectory(platforms/server)
elseif (WEB)
    add_subdirectory(platforms/web)
elseif (WIN32) 
    add_subdirectory(platforms/win32)
elseif (LINUX)
    add_subdirectory(platforms/linux)
elseif (MACOS)
    add_subdirectory(platforms/macos)
elseif (ANDROID)
    #add_subdirectory(platforms/android/app/src/main/cpp)
elseif (IOS)
    add_subdirectory(platforms/ios)
else()
    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src LuaGui)
    add_executable (main main.cpp)
    target_link_libraries(${PROJECT_NAME} PUBLIC "LuaGui")
endif()

#add_subdirectory(externals/luajit2 luajit2)
#add_subdirectory(tools/embed-resource embed-resource)
#add_subdirectory(test/sdl sdl)
#add_subdirectory(test/sdl-gl sdl-gl)
#add_subdirectory(test/resource resource)
#add_subdirectory(test/test test)
#add_subdirectory(test/cmake-install-package cmake-install-package)
#add_subdirectory(resources/fontdata fontdata)

